import {get, post, put} from "@/utils/request";
import {AxiosPromise} from "@/types/common";

/**
 * 根据 ID 获取字段信息
 * @param id 字段 ID
 */
export const useFieldTypeApi = (id: Number) => {
	return get('/generator/v1/fieldType/' + id)
}

/**
 * 新增或者删除字段类型
 * @param dataForm 数据表单
 */
export const useFieldTypeSubmitApi = (dataForm: any) => {
	if (dataForm.id) {
		return put('/generator/v1/fieldType', dataForm)
	} else {
		return post('/generator/v1/fieldType', dataForm)
	}
}
